<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Proximity Application</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51822 BLE SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('group__ble__sdk__app__proximity.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#groups">Modules</a>  </div>
  <div class="headertitle">
<div class="title">Proximity Application</div>  </div>
<div class="ingroups"><a class="el" href="group__ble__sdk__apps.html">Example Applications</a></div></div>
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="groups"></a>
Modules</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__proximity__main.html">main.c</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><p>Proximity Sample Application main file. </p>
<br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>The Proximity Application is a firmware example that implements the Proximity profile using the hardware delivered in the nRF51822 Development Kit. The Proximity profile alerts the user when connected devices are too far apart.</p>
<p>The source code and project file can be found in the <code>&lt;InstallFolder&gt;\Nordic\nrf51822\Board\nrf6310\ble\ble_app_proximity</code> folder.</p>
<p>The application includes all three services in the Proximity profile:</p>
<ul>
<li><a class="el" href="group__ble__sdk__srv__lls.html">Link Loss Service</a></li>
<li><a class="el" href="group__ble__sdk__srv__ias.html">Immediate Alert Service</a></li>
<li><a class="el" href="group__ble__sdk__srv__tps.html">TX Power Service</a></li>
</ul>
<p>In addition, use of the <a class="el" href="group__ble__sdk__srv__bas.html">Battery Service</a> and <a class="el" href="group__ble__sdk__lib__bond__manager.html">Bonds and Persistent Data Manager</a> are also demonstrated.</p>
<p>The Proximity Application does fast advertising for 30 seconds at power up and after a disconnection. It will then switch to slow advertising mode, and the Slow Advertising Mode LED (see below) is lit. When the link is lost, or when an alert is signaled using the <a class="el" href="group__ble__sdk__srv__ias.html">Immediate Alert Service</a>, an alert is indicated using the Mild Alert State LED or the High Alert State LED (see below), depending on the value of the Alert Level characteristic.</p>
<dl class="note"><dt><b>Note:</b></dt><dd><ul>
<li>The device will have to be in bonded state to change any characteristic in this application. </li>
<li>TX Power Level characteristic is not writable. </li>
<li>The application will stop advertising after 3 minutes and go to system-off mode. Push the button 0 restart advertising, or button 1 to erase all bonds and restart advertising. </li>
<li><b> This application asserts if the maximum number of bonded masters is reached and a disconnect occurs.</b> <br/>
 Button 1 can be used for clearing bonds in system-off mode.</li>
</ul>
</dd></dl>
<h2><a class="anchor" id="project_proximity_setup"></a>
Setup</h2>
<p>Instructions on how to set up the nRFgo Motherboard: <a class="el" href="group__ble__sdk__apps__setup.html">'Setup'</a>.</p>
<p>LED assignments:</p>
<ul>
<li>LED 0: Advertising</li>
<li>LED 1: Connected</li>
<li>LED 2: Mild alert state</li>
<li>LED 3: High alert state</li>
<li>LED 4: Slow advertising mode</li>
<li>LED 7: Asserted (i.e. an assert check in the application has failed)</li>
</ul>
<p>Buttons assignments:</p>
<ul>
<li>Button 0: Wake-up from system-off and restart advertising.</li>
<li>Button 1: Wake-up from system-off erase all bonds and restart advertising.</li>
</ul>
<h2><a class="anchor" id="project_proximity_test"></a>
Testing</h2>
<p>The Proximity Application can be tested using the Master Control Panel as follows:</p>
<ol type="1">
<li>Compile and program the application. Observe that the Advertising LED is lit.</li>
<li>Connect to the device from Master Control Panel (the device will be advertising as 'PRX_APPV0.1'), then bond and perform service discovery. Observe that the Connected LED is lit, and the Advertising LED is off.</li>
<li>Set the AlertLevel characteristic in <a class="el" href="group__ble__sdk__srv__ias.html">Immediate Alert Service</a> to 1 (click the 'hex' radio button, enter '01' in the text box and click the 'Send update' button), and observe that the Mild alert state LED is lit.</li>
<li>Change the AlertLevel value to 2, and observe that the High alert state LED is lit.</li>
<li>Change the AlertLevel value to 0, and observe that none of the alert state LEDs is lit.</li>
<li>Set the AlertLevel characteristic in <a class="el" href="group__ble__sdk__srv__lls.html">Link Loss Service</a> to 1.</li>
<li>Simulate a link loss situation (by e.g. shielding the Master Emulator), and observe that both the Mild alert state and Advertising LEDs are lit, and the Connected LED is off.</li>
<li>Reconnect and re-bond, and observe that only the Connected LED is lit.</li>
<li>Set the AlertLevel characteristic in <a class="el" href="group__ble__sdk__srv__lls.html">Link Loss Service</a> to 2.</li>
<li>Simulate a link loss situation by e.g. disconnecting the Master Emulator, and observe that the High alert state and Advertising LEDs are lit, and the Connected LED is off.</li>
<li>Reconnect and re-bond, and observe that only the Connected LED is lit.</li>
<li>Select the TxPowerLevel characteristic in <a class="el" href="group__ble__sdk__srv__tps.html">TX Power Service</a>, click the 'Read' button and verify that it was successfully read.</li>
<li>Click the 'Enable services' button to start notification of Battery Level and observe that the battery level is notified periodically.</li>
<li>Disconnect from the Master Control Panel and observe that the only the advertising LED is lit.</li>
<li>Wait until the application goes to system-off (all LEDs off).</li>
<li>Press button 0 and connect to the Master Control Panel. Observe that Connected LED is lit and that the battery level is notified periodically.</li>
<li>Disconnect from the Master Control Panel.</li>
<li>Connect with a different master and bond and disconnect.</li>
<li>Wait until the application goes to system-off (all LEDs off).</li>
<li>Press button 0 and re-connect to the first Master Control Panel. Observe that Connected LED is lit and that the battery level is notified periodically.</li>
<li>Disconnect from the Master Control Panel.</li>
<li>Connect with the second master and observe that the link encryption is on and that the battery level is not notified.</li>
<li>Disconnect from the second master and wait for the application to go to system-off.</li>
<li>Press button 1 (erase bonds) and connect with the first Master Control Panel. Observe that the link encryption is OFF and that no notifications are received. </li>
</ol>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
